package inabit.inabitcompiler.productions.rule.expressions.arithmetic;

import inabit.compiler.parser.grammar.NonTerminal;
import inabit.compiler.parser.grammar.Production;
import inabit.compiler.parser.grammar.Symbol;
import inabit.compiler.parser.grammar.Terminal;
import inabit.data.expression.arithmetic.StringExpression;
import inabit.inabitcompiler.lexical.InabitTokenClass;
import inabit.inabitcompiler.parser.InabitSemanticAction;

/**Z -> string_cte*/
/**@author Rafael Rocha*/
public class Z_Rule3 extends Production{

	private Terminal string_cte;
	
	public Z_Rule3() {
		super("Z");
	}

	@Override
	protected Symbol[] production(final NonTerminal nonTerminal) {
		string_cte = new Terminal(InabitTokenClass.STRING_CTE);
		Symbol[] symbols = {
			string_cte,
			new InabitSemanticAction(nonTerminal) {
				public void execute() {
					nonTerminal.code = addArithmeticExpressionAndGetCode(
							new StringExpression(string_cte.getValue()));
				}
			}
		};
		return symbols;
	}

}
